/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package maraton;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author Alejandro
 */
public class Maraton {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        int num=0;
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader (isr);
        String numero= br.readLine();
        num= Integer.parseInt(numero);
        String n1, n2, entrada;
        
        for (int i = 0; i < num; i++) {
            entrada= br.readLine();
            String[] parts = entrada.split(" ");
            n1= parts[0];
            n2 = parts[1]; 
            StringBuffer sb1 = new StringBuffer(n1);
            sb1 = sb1.reverse();
            StringBuffer sb2 = new StringBuffer(n2);
            sb2 = sb2.reverse();
            int suma= Integer.parseInt(sb1.toString())+ Integer.parseInt(sb2.toString());
            n1= Integer.toString(suma);
            sb2 = new StringBuffer(n1);
                        
            System.out.println(Integer.parseInt(sb2.reverse().toString()));
        }
    }
    
}
